<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>事件修饰符</title>
  <script src="./vue-2.4.0.js"></script>
  <style>
    .log1 {
      width: 300px;
      height: 300px;
      background-color: antiquewhite;
    }
    .log2 {
      width: 100px;
      height: 100px;
      background-color: rgb(2, 204, 255);
    }
  </style>
</head>
<body>
<div id="app">
  <!-- .stop阻止冒泡事件 -->
  <div @click="log1">
    <div @click="log2">
      <button @click.stop="stop">.stop</button>
    </div>
  </div>
  <!-- .capture 捕获：从外向里 先捕获再冒泡 -->
  <div @click="log1">
    <div @click.capture="log2">
      <button @click="log3">.capture</button>
    </div>
  </div>
  <!-- .self 触发本身事件时才触发 -->
  <div @click="log1" class="log1">
    <div @click.self="log2" class="log2">
      <button @click="log3" class="log3">.self</button>
    </div>
  </div>
  <!-- .once 只触发一次 -->
  <div @click="log1" class="log1">
    <div @click="log2" class="log2">
      <button @click.once="log3" class="log3">.self</button>
    </div>
  </div>
  <!-- .preven 阻止默认事件 -->
  <a href.preven="https://www.baidu.com">跳转百度</a>
</div>
</body>
<script>
  let vm = new Vue({
    el: '#app',
    data: {

    },
    methods: {
      stop () {
        console.log(111);
        console.log('阻止了冒泡');
      },
      log1 () {
        console.log(333);
      },
      log2 () {
        console.log(222);
      },
      log3 () {
        console.log(111);
      }

    }
  })
</script>
</html>